```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>设计模式解析：工厂方法与抽象工厂</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .gradient-text {
            background: linear-gradient(45deg, #3b82f6, #8b5cf6);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        .code-block {
            background: #2d3748;
            color: #e2e8f0;
            border-radius: 0.5rem;
            padding: 1.25rem;
            overflow-x: auto;
        }
        .pattern-card {
            transition: all 0.3s ease;
            border-radius: 0.75rem;
            overflow: hidden;
        }
        .pattern-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .feature-icon {
            font-size: 2rem;
            margin-bottom: 1rem;
            color: #3b82f6;
        }
        .footer-link:hover {
            color: #93c5fd;
        }
        .first-letter {
            float: left;
            font-size: 4.5rem;
            line-height: 0.8;
            margin-right: 0.5rem;
            margin-bottom: -0.3rem;
            color: #3b82f6;
            font-weight: 700;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="relative py-20 bg-gradient-to-r from-blue-500 to-indigo-600 text-white overflow-hidden">
        <div class="absolute inset-0 opacity-20" style="background-image: url('https://images.unsplash.com/photo-1579389083078-4e7018379f7e?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80'); background-size: cover;"></div>
        <div class="container mx-auto px-6 relative z-10">
            <div class="max-w-4xl mx-auto text-center">
                <h1 class="text-5xl md:text-6xl font-bold mb-6">设计模式深度解析</h1>
                <h2 class="text-3xl md:text-4xl font-semibold mb-8 gradient-text">工厂方法与抽象工厂</h2>
                <p class="text-xl md:text-2xl opacity-90 mb-10">探索创建型设计模式的核心思想与应用场景</p>
                <div class="flex justify-center space-x-4">
                    <a href="#factory-method" class="px-8 py-3 bg-white text-blue-600 font-semibold rounded-full hover:bg-gray-100 transition duration-300">工厂方法</a>
                    <a href="#abstract-factory" class="px-8 py-3 border-2 border-white text-white font-semibold rounded-full hover:bg-white hover:text-blue-600 transition duration-300">抽象工厂</a>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto">
                <p class="text-lg md:text-xl text-gray-700 mb-8">
                    <span class="first-letter">工</span>厂方法模式和抽象工厂模式都是创建型设计模式，旨在将对象的创建与使用解耦。虽然它们有相似之处，但它们的应用场景和设计目标有所不同。创建型设计模式帮助我们更好地管理系统中的对象创建过程，提高代码的灵活性和可维护性。
                </p>
                <div class="bg-blue-50 p-6 rounded-xl border-l-4 border-blue-500">
                    <div class="flex items-start">
                        <div class="flex-shrink-0 mr-4">
                            <i class="fas fa-lightbulb text-blue-500 text-2xl"></i>
                        </div>
                        <div>
                            <p class="font-medium text-blue-800">设计模式的核心思想是封装变化点，将变与不变分离，从而提高系统的可扩展性和可维护性。</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Comparison Diagram -->
    <section class="py-16 bg-gray-100">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto">
                <h2 class="text-3xl font-bold text-center mb-12">模式对比</h2>
                <div class="mermaid">
                    classDiagram
                        class FactoryMethod {
                            <<interface>>
                            +createProduct() Product
                        }
                        class ConcreteFactoryA {
                            +createProduct() Product
                        }
                        class ConcreteFactoryB {
                            +createProduct() Product
                        }
                        class Product {
                            <<interface>>
                            +use()
                        }
                        class ConcreteProductA {
                            +use()
                        }
                        class ConcreteProductB {
                            +use()
                        }
                        
                        class AbstractFactory {
                            <<interface>>
                            +createProductA() ProductA
                            +createProductB() ProductB
                        }
                        class ConcreteFactory1 {
                            +createProductA() ProductA
                            +createProductB() ProductB
                        }
                        class ConcreteFactory2 {
                            +createProductA() ProductA
                            +createProductB() ProductB
                        }
                        class ProductA {
                            <<interface>>
                            +use()
                        }
                        class ProductB {
                            <<interface>>
                            +use()
                        }
                        class ConcreteProductA1 {
                            +use()
                        }
                        class ConcreteProductA2 {
                            +use()
                        }
                        class ConcreteProductB1 {
                            +use()
                        }
                        class ConcreteProductB2 {
                            +use()
                        }
                        
                        FactoryMethod <|-- ConcreteFactoryA
                        FactoryMethod <|-- ConcreteFactoryB
                        Product <|-- ConcreteProductA
                        Product <|-- ConcreteProductB
                        ConcreteFactoryA --> ConcreteProductA
                        ConcreteFactoryB --> ConcreteProductB
                        
                        AbstractFactory <|-- ConcreteFactory1
                        AbstractFactory <|-- ConcreteFactory2
                        ProductA <|-- ConcreteProductA1
                        ProductA <|-- ConcreteProductA2
                        ProductB <|-- ConcreteProductB1
                        ProductB <|-- ConcreteProductB2
                        ConcreteFactory1 --> ConcreteProductA1
                        ConcreteFactory1 --> ConcreteProductB1
                        ConcreteFactory2 --> ConcreteProductA2
                        ConcreteFactory2 --> ConcreteProductB2
                </div>
            </div>
        </div>
    </section>

    <!-- Factory Method Section -->
    <section id="factory-method" class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto">
                <div class="flex items-center mb-12">
                    <div class="flex-shrink-0 bg-blue-100 p-3 rounded-full">
                        <i class="fas fa-industry text-blue-600 text-2xl"></i>
                    </div>
                    <div class="ml-4">
                        <h2 class="text-3xl font-bold">工厂方法模式</h2>
                        <p class="text-gray-600">Factory Method Pattern</p>
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-8 mb-12">
                    <div class="pattern-card bg-gradient-to-br from-blue-50 to-indigo-50 p-8 shadow-md">
                        <h3 class="text-xl font-bold mb-4 text-blue-800">定义</h3>
                        <p class="text-gray-700">工厂方法模式定义了一个创建对象的接口，但将实例化的具体类推迟到子类中。工厂方法模式允许子类决定实例化哪个类。</p>
                    </div>
                    <div class="pattern-card bg-gradient-to-br from-blue-50 to-indigo-50 p-8 shadow-md">
                        <h3 class="text-xl font-bold mb-4 text-blue-800">结构</h3>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li><strong>产品接口（Product）</strong>：定义产品的接口</li>
                            <li><strong>具体产品（ConcreteProduct）</strong>：实现产品接口的具体类</li>
                            <li><strong>工厂接口（Creator）</strong>：定义创建产品的工厂方法</li>
                            <li><strong>具体工厂（ConcreteCreator）</strong>：实现工厂接口并返回具体产品的工厂</li>
                        </ul>
                    </div>
                </div>
                
                <h3 class="text-2xl font-bold mb-6 text-gray-800">代码示例</h3>
                <div class="code-block mb-8">
                    <pre><code class="language-java">
// 产品接口
interface Product {
    void use();
}

// 具体产品
class ConcreteProductA implements Product {
    public void use() {
        System.out.println("Using Product A");
    }
}

// 具体产品
class ConcreteProductB implements Product {
    public void use() {
        System.out.println("Using Product B");
    }
}

// 工厂接口
abstract class Creator {
    public abstract Product factoryMethod();
}

// 具体工厂
class ConcreteCreatorA extends Creator {
    public Product factoryMethod() {
        return new ConcreteProductA();
    }
}

// 具体工厂
class ConcreteCreatorB extends Creator {
    public Product factoryMethod() {
        return new ConcreteProductB();
    }
}
                    </code></pre>
                </div>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <div class="pattern-card bg-white p-6 border border-gray-200 rounded-lg shadow-sm">
                        <h3 class="text-xl font-bold mb-4 text-blue-800">优点</h3>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li><strong>灵活性</strong>：通过工厂方法，可以在不修改客户端代码的情况下，轻松添加新产品</li>
                            <li><strong>封装性</strong>：客户端不需要知道具体的类实现，只需知道工厂提供的接口</li>
                        </ul>
                    </div>
                    <div class="pattern-card bg-white p-6 border border-gray-200 rounded-lg shadow-sm">
                        <h3 class="text-xl font-bold mb-4 text-blue-800">应用场景</h3>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li>当系统需要独立于产品的创建、组合和表示时</li>
                            <li>当系统需要一个产品的多种实现，而这些实现需要在运行时动态决定</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Abstract Factory Section -->
    <section id="abstract-factory" class="py-16 bg-gray-100">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto">
                <div class="flex items-center mb-12">
                    <div class="flex-shrink-0 bg-purple-100 p-3 rounded-full">
                        <i class="fas fa-warehouse text-purple-600 text-2xl"></i>
                    </div>
                    <div class="ml-4">
                        <h2 class="text-3xl font-bold">抽象工厂模式</h2>
                        <p class="text-gray-600">Abstract Factory Pattern</p>
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-8 mb-12">
                    <div class="pattern-card bg-gradient-to-br from-purple-50 to-indigo-50 p-8 shadow-md">
                        <h3 class="text-xl font-bold mb-4 text-purple-800">定义</h3>
                        <p class="text-gray-700">抽象工厂模式提供一个创建一系列相关或相互依赖对象的接口，而无需指定具体类。它包含多个工厂方法，用于创建多个产品系列。</p>
                    </div>
                    <div class="pattern-card bg-gradient-to-br from-purple-50 to-indigo-50 p-8 shadow-md">
                        <h3 class="text-xl font-bold mb-4 text-purple-800">结构</h3>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li><strong>产品抽象类（AbstractProduct）</strong>：定义产品的接口</li>
                            <li><strong>具体产品（ConcreteProduct）</strong>：实现产品接口的具体类</li>
                            <li><strong>抽象工厂（AbstractFactory）</strong>：定义创建多个产品的方法</li>
                            <li><strong>具体工厂（ConcreteFactory）</strong>：实现抽象工厂并创建具体产品系列</li>
                        </ul>
                    </div>
                </div>
                
                <h3 class="text-2xl font-bold mb-6 text-gray-800">代码示例</h3>
                <div class="code-block mb-8">
                    <pre><code class="language-java">
// 产品A接口
interface ProductA {
    void use();
}

// 产品B接口
interface ProductB {
    void use();
}

// 具体产品A1
class ConcreteProductA1 implements ProductA {
    public void use() {
        System.out.println("Using Product A1");
    }
}

// 具体产品A2
class ConcreteProductA2 implements ProductA {
    public void use() {
        System.out.println("Using Product A2");
    }
}

// 具体产品B1
class ConcreteProductB1 implements ProductB {
    public void use() {
        System.out.println("Using Product B1");
    }
}

// 具体产品B2
class ConcreteProductB2 implements ProductB {
    public void use() {
        System.out.println("Using Product B2");
    }
}

// 抽象工厂
interface AbstractFactory {
    ProductA createProductA();
    ProductB createProductB();
}

// 具体工厂1
class ConcreteFactory1 implements AbstractFactory {
    public ProductA createProductA() {
        return new ConcreteProductA1();
    }
    public ProductB createProductB() {
        return new ConcreteProductB1();
    }
}

// 具体工厂2
class ConcreteFactory2 implements AbstractFactory {
    public ProductA createProductA() {
        return new ConcreteProductA2();
    }
    public ProductB createProductB() {
        return new ConcreteProductB2();
    }
}
                    </code></pre>
                </div>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <div class="pattern-card bg-white p-6 border border-gray-200 rounded-lg shadow-sm">
                        <h3 class="text-xl font-bold mb-4 text-purple-800">优点</h3>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li><strong>一致性</strong>：能够确保产品系列中的产品能在一起协同工作</li>
                            <li><strong>扩展性</strong>：添加新产品系列时，只需要增加具体工厂类而不需要修改现有代码</li>
                        </ul>
                    </div>
                    <div class="pattern-card bg-white p-6 border border-gray-200 rounded-lg shadow-sm">
                        <h3 class="text-xl font-bold mb-4 text-purple-800">应用场景</h3>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li>当系统需要创建多个系列的产品，而这些产品通常需要一起使用时</li>
                            <li>当系统需要独立于产品的创建、组合和表示时，并且需要创建一系列相关或依赖的产品</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Summary Section -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto">
                <h2 class="text-3xl font-bold text-center mb-12">模式对比总结</h2>
                <div class="overflow-x-auto">
                    <table class="min-w-full bg-white border border-gray-200 rounded-lg overflow-hidden">
                        <thead class="bg-gray-50">
                            <tr>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">对比项</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">工厂方法模式</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">抽象工厂模式</th>
                            </tr>
                        </thead>
                        <tbody class="divide-y divide-gray-200">
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">关注点</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">单个产品的创建</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">多个相关产品的创建</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">结构特点</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">一个工厂方法创建一个产品</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">多个工厂方法创建一系列产品</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">扩展性</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">容易扩展新产品类型</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">容易扩展新产品系列</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">适用场景</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">产品种类较少且需要扩展单一产品类型</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">需要创建多个产品系列并确保它们协同工作</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </section>

    <!-- Key Takeaways -->
    <section class="py-16 bg-gradient-to-r from-blue-50 to-indigo-50">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto text-center">
                <h2 class="text-3xl font-bold mb-8">核心要点</h2>
                <div class="grid md:grid-cols-3 gap-8">
                    <div class="bg-white p-6 rounded-lg shadow-sm hover:shadow-md transition-shadow duration-300">
                        <div class="feature-icon">
                            <i class="fas fa-object-group"></i>
                        </div>
                        <h3 class="text-xl font-bold mb-3">解耦创建与使用</h3>
                        <p class="text-gray-700">将对象的创建与使用分离，提高代码的灵活性和可维护性</p>
                    </div>
                    <div class="bg-white p-6 rounded-lg shadow-sm hover:shadow-md transition-shadow duration-300">
                        <div class="feature-icon">
                            <i class="fas fa-layer-group"></i>
                        </div>
                        <h3 class="text-xl font-bold mb-3">层次结构清晰</h3>
                        <p class="text-gray-700">通过抽象层定义接口，具体实现由子类完成，层次分明</p>
                    </div>
                    <div class="bg-white p-6 rounded-lg shadow-sm hover:shadow-md transition-shadow duration-300">
                        <div class="feature-icon">
                            <i class="fas fa-expand-arrows-alt"></i>
                        </div>
                        <h3 class="text-xl font-bold mb-3">扩展性强</h3>
                        <p class="text-gray-700">添加新产品或产品系列无需修改现有代码，符合开闭原则</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-12">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto text-center">
                <h3 class="text-xl font-bold mb-4">技术小馆</h3>
                <p class="mb-6">探索编程艺术，分享技术之美</p>
                <a href="http://www.yuque.com/jtostring" class="footer-link text-blue-400 hover:underline transition duration-300">www.yuque.com/jtostring</a>
                <div class="mt-8">
                    <p class="text-gray-400 text-sm">© 2023 技术小馆. All rights reserved.</p>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            fontFamily: "'Noto Sans SC', sans-serif",
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```